<div ng-include="'web/include/header_menu.html'"></div>
<!--主体内容-->
<div class="content row" >
    <div class="my-main">
        <!--右侧表格-->
        <div class="right-main">
            <div class="col-sm-12 groupBtn">
                <button type="button" class="btn btn-info" ng-click="allotRole()" zg-access="userrole/getAllRoleByTenanid">分配角色</button>
                <button type="button" class="btn btn-info" ng-click="deleteUser()" zg-access="users/delete">删除用户</button>
                <!--<button type="button" class="btn btn-info"  data-toggle="modal"  data-target="#user" zg-access="users/add" ng-click="addUser()">新增用户</button>-->
                <button type="button" class="btn btn-info" zg-access="users/add" ng-click="addUser()">新增用户</button>
            </div>
            <table class="table table-striped table-bordered" id="userTable" style="width:100%">
                <thead>
                <tr>
                    <td>请选择</td>
                    <td>租户ID</td>
                    <td>用户名</td>
                    <td>性别</td>
                    <td>手机号</td>
                    <td>住址</td>
                    <td>账号状态</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody>
                </tbody>
            </table>
            <!--新增用户弹框-->
            <div aria-labelledby="addroleLabel" class="modal fade" id="user" role="dialog" tabindex="-1" data-backdrop="static">
                <div class="modal-dialog" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="addroleLabel">添加用户</h4>
                        </div>
                        <div class="modal-body">
                            <form class="form-horizontal" id="userForm">
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">租户名称</label>
                                    <div class="col-sm-9">
                                        <select ng-model="tenanid" class="form-control" ng-init="tenanid=tenans[0]" ng-options="tenan.id as tenan.tenanname
                                         for
                                         tenan in tenans" >
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">用户名</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" ng-model="username"  placeholder="请输入用户名" type="text" minlength="1" maxlength="33" autocomplete="off"  />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">密码</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" ng-model="password"  placeholder="请输入4-10位的密码（只能是数字和字母）" type="text"  autocomplete="off"  minlength="4" maxlength="10"/>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">手机号</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" ng-model="phone" placeholder="请输入手机号" type="text" value="" maxlength="11" autocomplete="off"  />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">邮箱</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" ng-model="email"  placeholder="请输入邮箱" type="text" value="" autocomplete="off"  />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">性别</label>
                                    <div class="col-sm-9">
                                        <select ng-model="sex" class="form-control" >
                                            <option ng-repeat="y in sexList" value="{{y.value}}">{{y.sex}}</option>
                                        </select>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label  class="col-sm-2 control-label">住址</label>
                                    <div class="col-sm-9">
                                        <input class="form-control" ng-model="address" placeholder="请输入住址" type="text" value=""  maxlength="200" autocomplete="off"  />
                                    </div>
                                </div>
                                <div class="modal-footer">
                                    <button class="btn btn-default" ng-click="close()" type="reset">取消</button>
                                    <button class="btn btn-primary" ng-click="addSure()" type="button">确定</button>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--分配角色的弹框-->
            <div aria-labelledby="selectRoleLabel"  class="modal fade bs-example-modal-sm" id="selectRole" role="dialog" tabindex="-1" data-backdrop="static">
                <div class="modal-dialog modal-sm" role="document">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button aria-label="Close" class="close" data-dismiss="modal" type="button"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title" id="selectRoleLabel">分配角色</h4>
                        </div>
                        <div class="modal-body">
                            <form id="boxRoleForm" >
                                <div class='form-group' ng-repeat="role in roleList">
                                    <label class="control-label"><input type='checkbox' value="{{role.id}}" ng-checked="role.flg == '1'"/>{{role.roledesc}}</label>
                                </div>

                            </form>
                        </div>
                        <div class="modal-footer">
                            <button class="btn btn-default" data-dismiss="modal" type="button">取消</button>
                            <button class="btn btn-primary" ng-click="saveUserRoles();" type="button">确定</button>
                        </div>
                    </div>
                </div>
            </div>
            <!--确认删除用户的弹框-->
            <div class="modal fade bd-example-modal-sm" id="deleteSure" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true"  data-backdrop="static">
                <div class="modal-dialog modal-sm">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                            <h4 class="modal-title">删除用户</h4>
                        </div>
                        <div class="modal-body">
                            <p>您确认删除该用户吗？</p>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                            <button type="button" class="btn btn-primary" ng-click="sureDelete()">确定</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div ng-include="'web/include/footer.html'"></div>
